3.2.áCreating a virtual machine

Clicking on the "New" button in the user interface will guide you through setting up a new virtual machine (VM). A wizard will show up:

On the following pages, the wizard will ask you for the bare minimum of information that is needed to create a VM, in particular:

  1. A name for your VM, and the type of operating system (OS) you want to install.

    The name is what you will later see in the VirtualBox main window, and what your settings will be stored under. It is purely informational, but once you have created a few VMs, you will appreciate if you have given your VMs informative names. "My VM" probably is therefore not as useful as "Windows XP SP2".

    For "Operating System Type", select the operating system that you want to install later. While this setting presently has no lasting effect, VirtualBox will use this setting to display an operating system accordingly and also make certain recommendations later based on your selection (such as the amount of memory and hard disk space to allocate), and future VirtualBox versions may offer certain system-specific virtualization features. It is therefore recommended to always set it to the correct value.

  2. The amount of memory (RAM) that the virtual machine should have for itself. Every time a virtual machine is started, VirtualBox will allocate this much memory from your host machine and present it to the guest operating system, which will report this size as the (virtual) computer's installed RAM.

    Note

    Choose this setting carefully! The memory you give to the VM will not be available to your host OS while the VM is running, so do not specify more than you can spare. For example, if your host machine has 1 GB of RAM and you enter 512 MB as the amount of RAM for a particular virtual machine, while that VM is running, you will only have 512 MB left for all the other software on your host. If you run two VMs at the same time, even more memory will be allocated for the second VM (which may not even be able to start if that memory is not available). On the other hand, you should specify as much as your guest OS (and your applications) will require to run properly.

    A Windows XP guest will require at least a few hundred MB RAM to run properly, and Windows Vista will even refuse to install with less than 512 MB. Of course, if you want to run graphics-intensive applications in your VM, you may require even more RAM.

    So, as a rule of thumb, if you have 1 GB of RAM or more in your host computer, it is usually safe to allocate 512 MB to each VM. But, in any case, make sure you always have at least 256-512 MB of RAM left on your host operating system. Otherwise you may cause your host OS to excessively swap out memory to your hard disk, effectively bringing your host system to a standstill.

    As with the other settings, you can change this setting later, after you have created the VM.

  3. Next, you must specify a virtual hard disk for your VM. There are several ways in which VirtualBox can provide hard disk space to a VM, but the most common way is to use a large image file on your "real" hard disk, whose contents VirtualBox presents to your VM as if it were a complete hard disk.

    The wizard presents to you the following window:

    The wizard allows you to create an image file or use an existing one. Note also that the disk images can be separated from a particular VM, so even if you delete a VM, you can keep the image, or copy it to another host and create a new VM for it there.

    In the wizard, you have the following options:

    • If you have previously created any virtual hard disks which have not been attached to other virtual machines, you can select those from the drop-down list in the wizard window.

    • Otherwise, to create a new virtual hard disk, press the "New" button.

    • Finally, for more complicated operations with virtual disks, the "Existing..." button will bring up the Virtual Disk Manager, which is described in more detail in Sectioná3.5, “The Virtual Disk Manager”.

    Most probably, if you are using VirtualBox for the first time, you will want to create a new disk image. Hence, press the "New" button.

    This brings up another window, the "Create New Virtual Disk Wizard".

    VirtualBox supports two types of image files:

    • A dynamically expanding file will only grow in size when the guest actually stores data on its virtual hard disk. It will therefore initially be small on the host hard drive and only later grow to the size specified as it is filled with data.

    • A fixed-size file will immediately occupy the file specified, even if only a fraction of the virtual hard disk space is actually in use. While occupying much more space, a fixed-size file incurs less overhead and is therefore slightly faster than a dynamically expanding file.

    For details about the differences, please refer to Sectioná5.2, “Virtual Disk Image (VDI) files”.

    To prevent your physical hard disk from running full, VirtualBox limits the size of the image file. Still, it needs to be large enough to hold the contents of your operating system and the applications you want to install -- for a modern Windows or Linux guest, you will probably need several gigabytes for any serious use:

    After having selected or created your image file, again press "Next" to go to the next page.

  4. After clicking on "Finish", your new virtual machine will be created. You will then see it in the list on the left side of the main window, with the name you have entered.